home *** CD-ROM | disk | FTP | other *** search
Text File | 1997-04-17 | 4.1 KB | 185 lines | [TEXT/ToyS] |
- property l1 : {¬
- "Klingon", ¬
- "Russian", ¬
- "Maldivian", ¬
- "Slavic", ¬
- "Sindhi", ¬
- "English", ¬
- "French", ¬
- "German", ¬
- "Italian", ¬
- "Dutch", ¬
- "Swedish", ¬
- "Spanish", ¬
- "Danish", ¬
- "Norwegian", ¬
- "Hebrew", ¬
- "Japanese", ¬
- "Arabic", ¬
- "Finnish", ¬
- "Greek", ¬
- "Icelandic", ¬
- "Maltese", ¬
- "Turkish", ¬
- "Croatian", ¬
- "Urdu", ¬
- "Hindi", ¬
- "Thai", ¬
- "Korean", ¬
- "Lithuanian", ¬
- "Polish", ¬
- "Hungarian", ¬
- "Estonian", ¬
- "Lettish", ¬
- "Latvian", ¬
- "Saamisk", ¬
- "Lappish", ¬
- "Faeroese", ¬
- "Farsi", ¬
- "Persian", ¬
- "Flemish", ¬
- "Irish", ¬
- "Albanian", ¬
- "Romanian", ¬
- "Czech", ¬
- "Slovak", ¬
- "Slovenian", ¬
- "Yiddish", ¬
- "Serbian", ¬
- "Macedonian", ¬
- "Bulgarian", ¬
- "Ukrainian", ¬
- "Byelorussian", ¬
- "Uzbek", ¬
- "Kazakh", ¬
- "Azerbaijani", ¬
- "Armenian", ¬
- "Georgian", ¬
- "Moldavian", ¬
- "Kirghiz", ¬
- "Tajiki", ¬
- "Turkmen", ¬
- "Mongolian", ¬
- "Pashto", ¬
- "Kurdish", ¬
- "Kashmiri", ¬
- "Tibetan", ¬
- "Nepali", ¬
- "Sanskrit", ¬
- "Marathi", ¬
- "Bengali", ¬
- "Assamese", ¬
- "Gujarati", ¬
- "Punjabi", ¬
- "Oriya", ¬
- "Malayalam", ¬
- "Kannada", ¬
- "Tamil", ¬
- "Telugu", ¬
- "Sinhalese", ¬
- "Burmese", ¬
- "Khmer", ¬
- "Lao", ¬
- "Vietnamese", ¬
- "Indonesian", ¬
- "Tagalog", ¬
- "Amharic", ¬
- "Tigrinya", ¬
- "Galla", ¬
- "Oromo", ¬
- "Somali", ¬
- "Swahili", ¬
- "Ruanda", ¬
- "Rundi", ¬
- "Chewa", ¬
- "Malagasy", ¬
- "Esperanto", ¬
- "Welsh", ¬
- "Basque", ¬
- "Catalan", ¬
- "Latin", ¬
- "Quechua", ¬
- "Guarani", ¬
- "Aymara", ¬
- "Tatar", ¬
- "Uighur", ¬
- "Dzongkha", ¬
- "Javanese", ¬
- "Sundanese", ¬
- "Portugese", ¬
- "Yugoslavian", ¬
- "Chinese", ¬
- "Lapponian"}
-
- set sortDialog to {size:[500, 196], name:"Sorted!", style:movable modal, contents:[¬
- {class:push button, name:"Sort", bounds:[210, 24, 290, 44]}, ¬
- {class:push button, name:"Done", bounds:[210, 53, 290, 73]}, ¬
- {class:push button, name:"Change", bounds:[210, 80, 290, 100], enabled:[dAnd, 6, 7]}, ¬
- {class:push button, name:"Append", bounds:[210, 107, 290, 127], enabled:7}, ¬
- {class:push button, name:"Delete", bounds:[210, 134, 290, 154], enabled:6}, ¬
- {class:list box, contents:l1, bounds:[10, 24, 190, 154], flags:130}, ¬
- {class:text field, bounds:[12, 170, 260, 186]}, ¬
- {class:list box, contents:[], bounds:[310, 24, 490, 154]}, ¬
- {class:static text, contents:"Source", bounds:[8, 4, 160, 20]}, ¬
- {class:static text, contents:"Destination", bounds:[308, 4, 460, 20]} ¬
- ]}
-
- dd install with greyscale
- set d to dd make dialog sortDialog
- repeat
- set i to dd interact with user
- --tell application "Transcript" to «event miscEcho» (i as string) & return
- if i = 1 then -- Sort
- DoSort(d)
- else if i = 2 then -- Cancel
- exit repeat
- else if i = 3 then -- Change
- set n to dd get value of item 6 of d
- set l1's item n to dd get value of item 7 of d
- dd set contents of item 6 of d to l1
- dd set value of item 6 of d to n
- else if i = 4 then -- Append
- set l1 to l1 & (dd get value of item 7 of d)
- dd set contents of item 6 of d to l1
- dd set value of item 6 of d to l1's length
- else if i = 5 then -- Delete
- set l1 to DelItem(l1, dd get value of item 6 of d)
- dd set contents of item 6 of d to l1
- else if i = 6 then -- List 1
- set n to dd get value of item 6 of d
- if n ≠ 0 then dd set value of item 7 of d to l1's item n
- end if
- end repeat
- dd uninstall
-
- on DoSort(d)
- set p to dd make dialog {size:[300, 50], contents:[¬
- {class:static text, contents:"Sorting…", bounds:[8, 4, 160, 20]}, ¬
- {class:gauge, bounds:[10, 25, 290, 25 + 12], value:0, max value:l1's length} ¬
- ]}
- try -- A simple bubble sort
- set l2 to l1
- repeat with n from 1 to l2's length
- repeat with j from 1 to (l2's length) - n
- if l2's item j > l2's item (j + 1) then
- set temp to l2's item j
- set l2's item j to l2's item (j + 1)
- set l2's item (j + 1) to temp
- end if
- end repeat
- dd set value of item 2 of p to n
- --if (dd interact with user for max ticks 0) = 1 then exit repeat
- end repeat
- dd set contents of item 8 of d to l2
- on error
- end try
- dd delete p
- end DoSort
-
- on DelItem(l, i)
- if i = length of l then
- return items 1 thru (i - 1) of l
- else
- return items 1 thru (i - 1) of l & items (i + 1) thru (length of l) of l
- end if
- end DelItem